<template>
	<view>
		<view class="workList" v-for="item in workList" :key="item._id" @click="workDetail(item._id)">
			<view class="workBox">
				<view class="left">
					<!-- {{item.cnExample}}
					{{item.enExample}} -->
					{{item.word}}
					<view class="nowTime">
						更新于<uni-dateformat  class="nowTime" :date="item.time" :threshold="[0,3600000]"></uni-dateformat>
					</view>
				</view>
				<view class="right">
				    {{item.mean}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import workListVue from './work-list.vue';
	export default {
		data() {
			return {
				workList:[],
				skip:0,
			};
		},
		onLoad() {
			this.getWorkList()
		},
		methods:{
			getWorkList(){
				uniCloud.callFunction({
					name:'work-get-list',
					data:{
						skip:this.skip
					}
				}).then(data=>{
					this.workList  = [...this.workList,...data.result.data]
					console.log(...data.result.data);
				})
			},
			workDetail(id){
				uni.navigateTo({
					url:'/pages/work-details/work-details?id='+id
				})
			}
		}
	}
</script>

<style lang="scss">
.workBox{
	height: 150rpx;
	// border: 2px solid red;
	padding: 8px;
	margin: 8px 0;
	border-radius: 8rpx;
	box-shadow: 1rpx 1rpx 16rpx  cadetblue;
}
.left{
	float: left;
	.nowTime{
		font-size: 20rpx;
		color: darkgray;
		margin: 65rpx 0 0;
	}
}
.right{
	float: right;
	width: 400rpx;
	height: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}
</style>
